import request from '@/utils/request'

// 创建商品订单
function saveOrder (data) {
  return request({
    method: 'POST',
    url: '/front/order/saveOrder',
    data
  })
}

// 获取支付方式
function getPayInfo (params) {
  return request({
    method: 'GET',
    url: '/front/pay/getPayInfo',
    params
  })
}

// 创建订单(发起支付)
function payOrder (data) {
  return request({
    method: 'POST',
    url: '/front/pay/saveOrder',
    data
  })
}

// 查询订单(支付结果)
function getPayResult (params) {
  return request({
    method: 'GET',
    url: '/front/pay/saveOrder',
    headers: { 'content-type': 'application/json' },
    params
  })
}

export {
  saveOrder,
  getPayInfo,
  payOrder,
  getPayResult
}
